package com.l024.user.config;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.SubjectContext;
import org.apache.shiro.web.mgt.DefaultWebSubjectFactory;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JwtDefaultSubjectFactory extends DefaultWebSubjectFactory {

    //于需要实现无状态的web，所以使用不到Shiro的Session功能，严谨点就是将其关闭
    // 如果调用getSession()方法会抛出异常
    @Override
    public Subject createSubject(SubjectContext context) {
        // 不创建 session
        context.setSessionCreationEnabled(true);
        return super.createSubject(context);
    }
}